import 'dart:io';

import 'package:flutter_clx_base/flutter_clx_base.dart';

import '../constants.dart';

class DeviceUtils {
  //uuid
  static getDeviceSerial() async {
    bool isAgree = SpUtil.getBool(Constants.firstInto) ?? false;
    if (!isAgree) {
      return "";
    }
    return "";
  }

  static getVersionName() async {
    PackageInfo packageInfo = await PackageInfo.fromPlatform();
    return packageInfo.version;
  }

  static getVersionCode() async {
    PackageInfo packageInfo = await PackageInfo.fromPlatform();
    return packageInfo.buildNumber.toInt();
  }

  static getDeviceModel() async {
    bool isAgree = SpUtil.getBool(Constants.firstInto) ?? false;
    if (!isAgree) {
      return "";
    }
    DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
    if (Platform.isAndroid) {
      AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
      return androidInfo.model;
    } else {
      IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
      return iosInfo.name;
    }
  }
}
